<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

</head>

<body>
    <input type="text" name="" id="input1">

    <script>
        const input1 = document.getElementById('input1')

        input1.onkeydown = function (e) {
            console.log('key', e.key);
            console.log('code', e.code);
            console.log('keyCode', e.keyCode);
        }

    </script>

</body>

</html>